﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Dynamic_UI_Framework
{
    /// <summary>
    /// NameDialog.xaml 的交互逻辑
    /// </summary>
    public partial class NameDialog : Window
    {
        public NameDialog()
        {
            InitializeComponent();
        }

        public string ItemName {
            get 
            {
                if (string.IsNullOrEmpty(this.txtName.Text))
                    return string.Empty;
                else
                    return this.txtName.Text;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                    this.txtName.Text = string.Empty;
                else
                    this.txtName.Text = value;
            }
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();

        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
